﻿using Admin.ApplicationLib.Entities;
using Admin.CommonLib.Models.Role;
using AutoMapper;

namespace Admin.WebApi.Mappers
{
    public class RoleProfile : Profile
    {
        public RoleProfile()
        {
            CreateMap<RoleEntity, RoleInfoResponseDto>()
                .ForMember(desc => desc.Key, opt => opt.MapFrom(src => src.Id))
                .ForMember(desc => desc.RoleCode, opt => opt.MapFrom(src => src.Code))
                .ForMember(desc => desc.RoleName, opt => opt.MapFrom(src => src.Name));

            CreateMap<RoleEditRequestDto, RoleEntity>()
                .ForMember(desc => desc.Code, opt => opt.MapFrom(src => src.RoleCode))
                .ForMember(desc => desc.Name, opt => opt.MapFrom(src => src.RoleName));
        
            CreateMap<RoleTemplateResponseDto,RoleEntity>()
                .ForMember(desc => desc.Code, opt => opt.MapFrom(src => src.RoleCode))
                .ForMember(desc => desc.Name, opt => opt.MapFrom(src => src.RoleName));
        
        }
    }
}